package com.itheima.boottlias.utils;

/**
 * @author ghy
 * @version 1.0
 * @since 2025-07-18 15:04
 */
public class ThreadLocalUtils {

    private static final ThreadLocal<Integer> THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 向当前线程中设置一个ID
     * @param id
     */
    public static void set(Integer id){
        THREAD_LOCAL.set(id);
    }

    /**
     * 从当前线程中获取ID
     * @return
     */
    public static Integer get() {
        return THREAD_LOCAL.get();
    }

    /**
     * 从当前线程中获取ID
     */
    public static void remove() {
        THREAD_LOCAL.remove();
    }

}
